/**
 * Created by weikexin .
 * description:
 **/
import {HTTP} from '../util/http'

class Shop extends HTTP {
    buyShopList(params, success) {
        let url = 'BuyShopManagement/queryBuyShopManagementPage'
        let data = Object.assign({},
            params,
            {
                rnd: 666,
                count: 10
            })
        this.request({
          url: url,
          method: 'POST',
          urlData: data,
          success
        })
    }

    sellShopList(params, success) {
        let url = 'SellShopManagement/querySellShopManagementPage'
        let data = Object.assign({},
            params,
            {
                rnd: 666,
                count: 10
            })
        this.request({
          url: url,
          method: 'POST',
          urlData: data,
          success
        })
    }

    update(params, success) {
        let url = 'SellShopManagement/updateById'
        let data = Object.assign({},
            params)
        this.request({
            method: 'POST',
            url: url,
            data: data,
            success
        })
    }

    publishBuyShop(params, success, fail) {
        let url = 'BuyShopManagement/save'
        let data = Object.assign({},
            params,
            {})
        this.request({
            method: 'POST',
            url: url,
            data: data,
            success,
            fail
        })
    }

    publishSellShop(params, success, fail) {
        let url = 'SellShopManagement/save'
        let data = Object.assign({},
            params,
            {})
        this.request({
            method: 'POST',
            url: url,
            data: data,
            success,
            fail
        })
    }
    
    updateBuyShop(params, success, fail) {
        let url = 'BuyShopManagement/updateById'
        let data = Object.assign({},
            params,
            {})
        this.request({
            method: 'POST',
            url: url,
            data: data,
            success,
            fail
        })
    }

    deleteBuyShop(params, success, fail) {
        let url = 'BuyShopManagement/deleteById'
        let data = Object.assign({},
            params,
            {})
        this.request({
            method: 'POST',
            url: url,
            urlData: data,
            success,
            fail
        })
    }

    deleteSellShop(params, success, fail) {
        let url = 'SellShopManagement/deleteById'
        let data = Object.assign({},
            params,
            {})
        this.request({
            method: 'POST',
            url: url,
            urlData: data,
            success,
            fail
        })
    }

    buyShopDetail(params, success) {
        let url = 'BuyShopManagement/queryDetailById'
        let data = Object.assign({},
            params,
            {
                userId: wx.getStorageSync('userInfo').user_id || 0
            })
        this.request({
            url: url,
            data: data,
            success
        })
    }

    sellShopDetail(params, success) {
        let url = 'SellShopManagement/queryDetailById'
        let data = Object.assign({},
            params,
            {
                userId: wx.getStorageSync('userInfo').user_id || 0
            })
        this.request({
            url: url,
            data: data,
            success
        })
    }

    category(success) {
        let url = 'shop/shopTransfer/category'
        let data = {
            rnd: 666
        }
        this.request({
            url: url,
            data: data,
            success
        })
    }
}

export {Shop}
